package com.sina.weibo;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.sina.weibo.models.Fan;
import com.sina.weibo.models.FavHotWord;
import com.sina.weibo.models.MBlog;
import com.sina.weibo.models.User;
import com.sina.weibo.models.UserInfo;
import com.sina.weibo.view.MBlogListItemView;
import com.sina.weibo.view.MainListItemView;
import com.sina.weibo.view.UserFansItemView;
import com.sina.weibo.view.UserTopicItemView;
import java.io.File;
import java.util.Iterator;
import java.util.List;

public class UserWeiboAttentionFansList extends ListBaseActivity
  implements ListItemEventHandler
{
  public static final int BACK2HOME = 1;
  private static final int ITEMMENU_BACK = 0;
  private static final int ITEMMENU_BOOKMARK = 3;
  private static final int ITEMMENU_COMMENT = 2;
  private static final int ITEMMENU_FORWARD = 1;
  public static final int MODE_ATTENTION = 2;
  public static final int MODE_FANS = 3;
  public static final int MODE_TOPIC = 4;
  public static final int MODE_USER = 0;
  public static final int MODE_WEIBO = 1;
  private static final int PAGE_NUM = 20;
  public static final int SWITCHUSER = 0;
  public static final int TOPIC_ITEM = 2;
  private boolean itemDeleted = 0;
  WeiboFansListAdapter mAdapter;
  private String mCacheDir;
  private String mCurNick = "";
  private String mCurUid = "";
  private ListView mLvUser;
  private int mMode = 0;
  private String mNick;
  private String mPassword;
  private boolean mPrefAutoloadMore;
  private int mPrefPictureSize;
  private boolean mPrefShowPicture;
  private int mReadMode;
  private BroadcastReceiver mReceiver;
  private String mUid;
  private User mUser;
  private String mUsername;

  public UserWeiboAttentionFansList()
  {
    UserWeiboAttentionFansList.1 local1 = new UserWeiboAttentionFansList.1(this);
    this.mReceiver = local1;
  }

  private void load_settings()
  {
    SharedPreferences localSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    boolean bool1 = localSharedPreferences.getBoolean("show_picture", 1);
    this.mPrefShowPicture = bool1;
    int i = Integer.parseInt(localSharedPreferences.getString("picture_size", "240"));
    this.mPrefPictureSize = i;
    boolean bool2 = localSharedPreferences.getBoolean("autoload_more", 0);
    this.mPrefAutoloadMore = bool2;
    int j = getIntent().getExtras().getInt("mode");
    this.mMode = j;
  }

  public void dismissProgressBar()
  {
    if ((this.mPgToast != null) && (this.mPgToast.isShown()))
      this.mPgToast.cancel();
  }

  protected void doItemMenu(String paramString)
  {
  }

  protected BaseAdapter getAdapter()
  {
    if (this.mAdapter == null)
    {
      WeiboFansListAdapter localWeiboFansListAdapter = new WeiboFansListAdapter(this);
      this.mAdapter = localWeiboFansListAdapter;
    }
    return this.mAdapter;
  }

  protected List<CharSequence> getMenuContent()
  {
    return null;
  }

  protected Object[] getMessages(int paramInt1, int paramInt2)
  {
    User localUser1 = StaticInfo.mUser;
    this.mUser = localUser1;
    Object localObject1 = (Object[])0;
    try
    {
      if (this.mUser == null)
      {
        RPCHelper localRPCHelper1 = RPCHelper.getInstance(getApplication());
        String str1 = this.mUsername;
        String str2 = this.mPassword;
        User localUser2 = localRPCHelper1.login(str1, str2);
        this.mUser = localUser2;
      }
      if (this.mUser == null)
      {
        localObject2 = null;
        return localObject2;
      }
      if (this.mUid == null)
      {
        RPCHelper localRPCHelper2 = RPCHelper.getInstance(getApplication());
        User localUser3 = this.mUser;
        String str3 = this.mNick;
        String str4 = localRPCHelper2.getUserInfo(localUser3, null, str3).uid;
        this.mUid = str4;
      }
      switch (this.mMode)
      {
      default:
      case 1:
      case 2:
      case 3:
      case 4:
      }
      while (true)
      {
        if (localObject1 == null)
          break label360;
        localObject2 = localObject1;
        break;
        RPCHelper localRPCHelper3 = RPCHelper.getInstance(getApplication());
        User localUser4 = this.mUser;
        String str5 = this.mUid;
        int i = this.mPrefPictureSize;
        int j = paramInt1;
        localObject1 = localRPCHelper3.getUserMBlogList(localUser4, str5, i, j, 20);
        continue;
        RPCHelper localRPCHelper4 = RPCHelper.getInstance(getApplication());
        User localUser5 = this.mUser;
        String str6 = this.mUid;
        int k = paramInt1;
        localObject1 = localRPCHelper4.getAttentionList(localUser5, 0, str6, 1, null, 1, k, 20);
        continue;
        RPCHelper localRPCHelper5 = RPCHelper.getInstance(getApplication());
        User localUser6 = this.mUser;
        String str7 = this.mUid;
        int m = paramInt1;
        localObject1 = localRPCHelper5.getAttentionList(localUser6, 1, str7, 3, null, 1, m, 20);
        continue;
        RPCHelper localRPCHelper6 = RPCHelper.getInstance(getApplication());
        User localUser7 = this.mUser;
        String str8 = this.mUid;
        Object[] arrayOfObject = localRPCHelper6.getFavHotWordList(localUser7, str8, paramInt1, 20);
        localObject1 = arrayOfObject;
      }
    }
    catch (RPCHelper.HttpException localHttpException)
    {
      while (true)
      {
        Object localObject2 = null;
        continue;
        label360: localObject2 = null;
      }
    }
  }

  protected void handleListItemClickEvent(int paramInt)
  {
    int i = this.mExpectItem - 1;
    switch (paramInt)
    {
    default:
    case 0:
    case 1:
    }
    while (true)
    {
      return;
      if (getMenuContent() == null)
        continue;
      List localList = getMenuContent();
      showItemMenu(localList);
      continue;
      switch (this.mMode)
      {
      default:
        break;
      case 1:
        this.mExpectItem = i;
        MBlog localMBlog = (MBlog)this.mList.get(i);
        Intent localIntent1 = new Intent();
        Context localContext = getApplicationContext();
        Intent localIntent2 = localIntent1.setClass(localContext, DetailWeiboActivity.class).putExtra("KEY_MBLOG", localMBlog);
        User localUser = StaticInfo.mUser;
        Intent localIntent3 = localIntent2.putExtra("KEY_MUSR", localUser);
        startActivity(localIntent3);
        break;
      case 2:
      case 3:
        Intent localIntent4 = new Intent(this, UserInfoActivity2.class);
        String str1 = ((Fan)this.mList.get(i)).uid;
        String str2 = ((Fan)this.mList.get(i)).nick;
        Intent localIntent5 = localIntent4.putExtra("uid", str1);
        Intent localIntent6 = localIntent4.putExtra("nick", str2);
        boolean bool = ((Fan)this.mList.get(i)).isVip;
        Intent localIntent7 = localIntent4.putExtra("vip", bool);
        startActivity(localIntent4);
        break;
      case 4:
        FavHotWord localFavHotWord = (FavHotWord)this.mList.get(i);
        Intent localIntent8 = new Intent(this, UserTopicAttentionList.class);
        String str3 = localFavHotWord.favword;
        Intent localIntent9 = localIntent8.putExtra("query", str3);
        String str4 = localFavHotWord.favid;
        Intent localIntent10 = localIntent8.putExtra("favid", str4);
        Intent localIntent11 = localIntent8.putExtra("mode", "MODE_SEARCH");
        String str5 = this.mUser.uid;
        Intent localIntent12 = localIntent8.putExtra("uid", str5);
        String str6 = this.mUser.nick;
        Intent localIntent13 = localIntent8.putExtra("nick", str6);
        String str7 = this.mUsername;
        Intent localIntent14 = localIntent8.putExtra("username", str7);
        String str8 = this.mPassword;
        Intent localIntent15 = localIntent8.putExtra("password", str8);
        Intent localIntent16 = localIntent8.putExtra("owner", "other");
        startActivityForResult(localIntent8, 2);
      }
    }
  }

  public void handleListItemEvent(int paramInt1, int paramInt2)
  {
  }

  protected void handleTaskResult(List<?> paramList, String paramString)
  {
    if (this.mPgToast != null)
      this.mPgToast.cancel();
    if (paramList != null)
      if (this.mList == null)
      {
        this.mList = paramList;
        String str1 = this.mUid;
        this.mCurUid = str1;
        String str2 = this.mNick;
        this.mCurNick = str2;
      }
    while (true)
    {
      return;
      if (paramList.size() > 0)
      {
        int i = 0;
        Iterator localIterator1;
        if (this.mMode == 1)
        {
          localIterator1 = paramList.iterator();
          label80: break label155;
          label81: if (!localIterator1.hasNext())
          {
            label90: break label316;
            break label223;
            break label315;
            break label222;
          }
        }
        while (true)
        {
          if ((i == 0) || (!this.mTaskFree))
            break label401;
          int j = this.mPage - 1;
          this.mPage = j;
          int k = this.mPage;
          loadMore(k);
          break;
          Object localObject1 = (MBlog)localIterator1.next();
          Iterator localIterator2 = this.mList.iterator();
          label155: if (!localIterator2.hasNext())
            break label81;
          Object localObject2 = localIterator2.next();
          String str3 = ((MBlog)localObject1).mblogid;
          String str4 = ((MBlog)localObject2).mblogid;
          if (!str3.equals(str4))
            break label80;
          i = 1;
          continue;
          if (this.mMode == 4)
          {
            localIterator1 = paramList.iterator();
            label222: break label256;
            label223: if (!localIterator1.hasNext())
              continue;
            localObject1 = (FavHotWord)localIterator1.next();
            localIterator2 = this.mList.iterator();
            label256: if (!localIterator2.hasNext())
              break label90;
            Object localObject3 = localIterator2.next();
            String str5 = ((FavHotWord)localObject1).favid;
            String str6 = ((FavHotWord)localObject3).favid;
            if (!str5.equals(str6))
              break label90;
            i = 1;
            continue;
          }
          localIterator1 = paramList.iterator();
          label315: break label349;
          label316: if (!localIterator1.hasNext())
            continue;
          localObject1 = (Fan)localIterator1.next();
          localIterator2 = this.mList.iterator();
          label349: if (!localIterator2.hasNext())
            break label90;
          Object localObject4 = localIterator2.next();
          String str7 = ((Fan)localObject1).uid;
          String str8 = ((Fan)localObject4).uid;
          if (!str7.equals(str8))
            break label90;
          i = 1;
        }
        label401: boolean bool = this.mList.addAll(paramList);
        break;
      }
      int m = this.mPage - 1;
      this.mPage = m;
      break;
      String str9 = getString(2131427376);
      Toast.makeText(this, str9, 0).show();
    }
  }

  protected void handleTitleBarEvent(int paramInt)
  {
    switch (paramInt)
    {
    default:
    case 0:
    case 1:
    }
    while (true)
    {
      return;
      Intent localIntent1 = new Intent(this, MainTabActivity.class);
      Intent localIntent2 = localIntent1.putExtra("MODE_KEY", 0);
      Intent localIntent3 = localIntent1.setAction("com.sina.weibo.action.go_back_to_home");
      startActivity(localIntent1);
      finish();
      continue;
      finish();
    }
  }

  protected void loadCache()
  {
  }

  protected void loadCache(int paramInt)
  {
  }

  protected void loadMore(int paramInt)
  {
    reloadBegine(0);
    this.mExpectItem = paramInt;
    ListBaseActivity.FetchDataTask localFetchDataTask1 = new ListBaseActivity.FetchDataTask(this);
    this.mTask = localFetchDataTask1;
    int i = this.mPage + 1;
    this.mPage = i;
    String str = String.valueOf(i);
    ListBaseActivity.FetchDataTask localFetchDataTask2 = this.mTask;
    String[] arrayOfString = new String[1];
    arrayOfString[0] = str;
    AsyncTask localAsyncTask = localFetchDataTask2.execute(arrayOfString);
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
    if (paramInt1 == 1)
    {
      setResult(-1, null);
      finish();
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    String str1 = getCacheDir().getPath();
    this.mCacheDir = str1;
    String str2 = getIntent().getStringExtra("username");
    this.mUsername = str2;
    String str3 = getIntent().getStringExtra("password");
    this.mPassword = str3;
    ListView localListView = this.mlvBase;
    this.mLvUser = localListView;
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("com.sina.weibo.intent.action.BLOG_DELETE");
    localIntentFilter.addCategory("android.intent.category.DEFAULT");
    BroadcastReceiver localBroadcastReceiver = this.mReceiver;
    Intent localIntent = registerReceiver(localBroadcastReceiver, localIntentFilter);
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    getMenuInflater().inflate(2131558404, paramMenu);
    return true;
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    switch (paramMenuItem.getItemId())
    {
    default:
    case 2131624250:
    }
    while (true)
    {
      return false;
      Intent localIntent1 = new Intent(this, MainTabActivity.class);
      Intent localIntent2 = localIntent1.setFlags(67108864);
      startActivity(localIntent1);
    }
  }

  public void onPause()
  {
    super.onPause();
    if ((!this.mTaskFree) && (this.mTask != null) && (!this.mTask.isCancelled()))
    {
      if (this.mPgToast != null)
        this.mPgToast.cancel();
      boolean bool = this.mTask.cancel(1);
      this.mTaskFree = 1;
    }
    if (isFinishing())
    {
      BroadcastReceiver localBroadcastReceiver = this.mReceiver;
      unregisterReceiver(localBroadcastReceiver);
    }
  }

  public boolean onPrepareOptionsMenu(Menu paramMenu)
  {
    return true;
  }

  protected void onResume()
  {
    super.onResume();
    int i = getSharedPreferences("readmode", 0).getInt("readmode", 0);
    if (this.mReadMode != i)
    {
      this.mReadMode = i;
      this.mAdapter.notifyDataSetChanged();
    }
    load_settings();
    Bundle localBundle = getIntent().getExtras();
    if (MainTabActivity.mFansReload)
      MainTabActivity.mFansReload = 0;
    String str1 = localBundle.getString("uid");
    this.mUid = str1;
    String str2 = localBundle.getString("nick");
    this.mNick = str2;
    String str5;
    if ((this.mUid == null) || (this.mUid.equals("")))
    {
      this.mUid = null;
      if (this.mCurNick != null)
      {
        String str3 = this.mCurNick;
        String str4 = this.mNick;
        boolean bool1 = str3.equals(str4);
      }
      int j = localBundle.getInt("mode");
      this.mMode = j;
      str5 = "";
      switch (this.mMode)
      {
      default:
        label196: String str6 = getString(2131427528);
        String str7 = getString(2131427368);
        setTitleBar(1, str6, str5, str7);
        if ((this.mUsername.length() != 0) && (this.mPassword.length() != 0))
          break;
        Intent localIntent = new Intent(this, SwitchUser.class);
        startActivityForResult(localIntent, 0);
      case 1:
      case 3:
      case 4:
      case 2:
      }
    }
    while (true)
    {
      return;
      if (this.mCurUid == null)
        break;
      String str8 = this.mUid;
      String str9 = this.mCurUid;
      boolean bool2 = str8.equals(str9);
      break;
      str5 = getString(2131427453);
      break label196;
      str5 = getString(2131427455);
      break label196;
      str5 = getString(2131427456);
      break label196;
      str5 = getString(2131427454);
      break label196;
      if (((this.mList == null) || (this.mMode == 4)) && (this.mTaskFree))
      {
        if (this.mPgToast != null)
          this.mPgToast.cancel();
        this.mLvUser.setVisibility(4);
        reloadList();
        continue;
      }
      if ((this.mList == null) || (!this.itemDeleted))
        continue;
      this.mAdapter.notifyDataSetChanged();
      this.itemDeleted = 0;
    }
  }

  protected void reloadList()
  {
    reloadBegine(1);
    this.mBeReload = 1;
    this.mPage = 1;
    this.mNewCount = 0;
    if (this.mTaskFree)
    {
      String str = String.valueOf(this.mPage);
      ListBaseActivity.FetchDataTask localFetchDataTask1 = new ListBaseActivity.FetchDataTask(this);
      this.mTask = localFetchDataTask1;
      ListBaseActivity.FetchDataTask localFetchDataTask2 = this.mTask;
      String[] arrayOfString = new String[1];
      arrayOfString[0] = str;
      AsyncTask localAsyncTask = localFetchDataTask2.execute(arrayOfString);
    }
    this.mExpectItem = 1;
  }

  protected void saveListCache(int paramInt, List<?> paramList)
  {
  }

  protected void setContentView()
  {
    setView(2130903093);
  }

  public void showProgressBar()
  {
    if ((this.mPgToast != null) && (this.mPgToast.isShown()))
      this.mPgToast.cancel();
    showProgress(0);
  }

  class WeiboFansListAdapter extends BaseAdapter
  {
    private Context mContext;

    public WeiboFansListAdapter(Context arg2)
    {
      Object localObject;
      this.mContext = localObject;
    }

    public int getCount()
    {
      int i;
      if (UserWeiboAttentionFansList.this.mList == null)
        i = 0;
      while (true)
      {
        return i;
        int j = UserWeiboAttentionFansList.this.mList.size();
        int k = UserWeiboAttentionFansList.this.mTotals;
        if (j < k)
        {
          i = UserWeiboAttentionFansList.this.mList.size() + 2;
          continue;
        }
        i = UserWeiboAttentionFansList.this.mList.size() + 1;
      }
    }

    public Object getItem(int paramInt)
    {
      return Integer.valueOf(paramInt);
    }

    public long getItemId(int paramInt)
    {
      return paramInt;
    }

    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      paramInt += -1;
      Object localObject1;
      if (paramInt == -1)
        localObject1 = UserWeiboAttentionFansList.this.getReloadView();
      while (true)
      {
        label20: return localObject1;
        int i = UserWeiboAttentionFansList.this.mList.size();
        if (paramInt == i)
        {
          localObject1 = UserWeiboAttentionFansList.this.getLoadMoreView();
          continue;
        }
        if (UserWeiboAttentionFansList.this.mExpectItem == paramInt);
        int k;
        for (int j = 1; ; k = 0)
        {
          if ((UserWeiboAttentionFansList.this.mMode != 2) && (UserWeiboAttentionFansList.this.mMode != 3))
          {
            j = 1;
            UserWeiboAttentionFansList.this.mPrefShowPicture = 0;
          }
          switch (UserWeiboAttentionFansList.this.mMode)
          {
          case 2:
          case 3:
          default:
            if (paramView != null)
              break label629;
            Context localContext1 = this.mContext;
            ListView localListView1 = UserWeiboAttentionFansList.this.mLvUser;
            Fan localFan1 = (Fan)UserWeiboAttentionFansList.this.mList.get(paramInt);
            boolean bool1 = UserWeiboAttentionFansList.this.mPrefShowPicture;
            UserWeiboAttentionFansList localUserWeiboAttentionFansList1 = UserWeiboAttentionFansList.this;
            int m = UserWeiboAttentionFansList.this.mReadMode;
            localObject1 = new UserFansItemView(localContext1, localListView1, localFan1, j, bool1, localUserWeiboAttentionFansList1, m);
            break label20;
          case 1:
          case 4:
          }
        }
        if (paramView == null)
        {
          Context localContext2 = this.mContext;
          ListView localListView2 = UserWeiboAttentionFansList.this.mLvUser;
          MBlog localMBlog1 = (MBlog)UserWeiboAttentionFansList.this.mList.get(paramInt);
          boolean bool2 = UserWeiboAttentionFansList.this.mPrefShowPicture;
          int n = UserWeiboAttentionFansList.this.mReadMode;
          localObject1 = new MBlogListItemView(localContext2, localListView2, localMBlog1, k, bool2, 0, 0, n);
          continue;
        }
        localObject1 = paramView;
        try
        {
          MainListItemView localMainListItemView = (MainListItemView)localObject1;
          Object localObject2 = UserWeiboAttentionFansList.this.mList.get(paramInt);
          boolean bool3 = UserWeiboAttentionFansList.this.mPrefShowPicture;
          int i1 = UserWeiboAttentionFansList.this.mReadMode;
          localMainListItemView.update(localObject2, k, bool3, 0, i1);
        }
        catch (Exception localException1)
        {
          Context localContext3 = this.mContext;
          ListView localListView3 = UserWeiboAttentionFansList.this.mLvUser;
          MBlog localMBlog2 = (MBlog)UserWeiboAttentionFansList.this.mList.get(paramInt);
          boolean bool4 = UserWeiboAttentionFansList.this.mPrefShowPicture;
          int i2 = UserWeiboAttentionFansList.this.mReadMode;
          localObject1 = new MBlogListItemView(localContext3, localListView3, localMBlog2, k, bool4, 0, 0, i2);
        }
        continue;
        if (paramView == null)
        {
          Context localContext4 = this.mContext;
          ListView localListView4 = UserWeiboAttentionFansList.this.mLvUser;
          FavHotWord localFavHotWord1 = (FavHotWord)UserWeiboAttentionFansList.this.mList.get(paramInt);
          localObject1 = new UserTopicItemView(localContext4, localListView4, localFavHotWord1, k);
          continue;
        }
        localObject1 = paramView;
        try
        {
          UserTopicItemView localUserTopicItemView = (UserTopicItemView)localObject1;
          Object localObject3 = UserWeiboAttentionFansList.this.mList.get(paramInt);
          int i3 = UserWeiboAttentionFansList.this.mReadMode;
          localUserTopicItemView.update(localObject3, k, 0, 0, i3);
        }
        catch (Exception localException2)
        {
          Context localContext5 = this.mContext;
          ListView localListView5 = UserWeiboAttentionFansList.this.mLvUser;
          FavHotWord localFavHotWord2 = (FavHotWord)UserWeiboAttentionFansList.this.mList.get(paramInt);
          localObject1 = new UserTopicItemView(localContext5, localListView5, localFavHotWord2, k);
        }
        continue;
        label629: localObject1 = paramView;
        try
        {
          UserFansItemView localUserFansItemView = (UserFansItemView)localObject1;
          Object localObject4 = UserWeiboAttentionFansList.this.mList.get(paramInt);
          boolean bool5 = UserWeiboAttentionFansList.this.mPrefShowPicture;
          int i4 = UserWeiboAttentionFansList.this.mReadMode;
          localUserFansItemView.update(localObject4, k, bool5, 0, i4);
        }
        catch (Exception localException3)
        {
          Context localContext6 = this.mContext;
          ListView localListView6 = UserWeiboAttentionFansList.this.mLvUser;
          Fan localFan2 = (Fan)UserWeiboAttentionFansList.this.mList.get(paramInt);
          boolean bool6 = UserWeiboAttentionFansList.this.mPrefShowPicture;
          UserWeiboAttentionFansList localUserWeiboAttentionFansList2 = UserWeiboAttentionFansList.this;
          int i5 = UserWeiboAttentionFansList.this.mReadMode;
          localObject1 = new UserFansItemView(localContext6, localListView6, localFan2, k, bool6, localUserWeiboAttentionFansList2, i5);
        }
      }
    }

    public void refresh()
    {
      notifyDataSetChanged();
    }
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     com.sina.weibo.UserWeiboAttentionFansList
 * JD-Core Version:    0.6.0
 */